<?php
/**
 * 订单列表
 */
namespace App\Http\Controllers\Home;

use App\Models\DownloadRecord;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;

class OrdersController extends Controller
{
	/**
	 * 订单列表
	 *
	 * @return \Illuminate\Http\Response
	 */
	public function getList()
	{
        $orders = DownloadRecord::select('id', 'user_id', 'file_title', 'pay_amount', 'created_at')
            ->where('is_pay', 'finish')
            ->where('user_id', Auth::id())
            ->orderBy('created_at', 'desc')
            ->paginate(10);

		return view('home.orders', ['orders' => $orders]);
	}
}
